<?php

/**
 * This is the model class for table "{{kit_news_article}}".
 *
 * The followings are the available columns in table '{{kit_news_article}}':
 * @property integer $id
 * @property string $name
 * @property string $keyword
 * @property integer $cat_id
 * @property integer $effecttime
 * @property integer $expiredtime
 * @property string $images
 * @property string $article_gallery
 * @property string $article_desc
 * @property string $article_content
 * @property integer $countview
 * @property integer $focus
 * @property integer $itemorder
 * @property integer $creator
 * @property integer $created
 * @property integer $editor
 * @property integer $edited
 * @property integer $active
 * @property integer $recycle
 */
class BaseKitNewsArticle extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return KitNewsArticle the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{kit_news_article}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
            array('cat_id, effecttime, expiredtime, countview, focus, itemorder, creator, created, editor, edited, active, recycle', 'numerical', 'integerOnly'=>true),
			array('name, images', 'length', 'max'=>255),
			array('keyword, article_gallery, article_desc, article_content', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, name, keyword, cat_id, effecttime, expiredtime, images, article_gallery, article_desc, article_content, countview, focus, itemorder, creator, created, editor, edited, active, recycle', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'name' => 'Name',
			'keyword' => 'Keyword',
			'cat_id' => 'Cat',
			'effecttime' => 'Effecttime',
			'expiredtime' => 'Expiredtime',
			'images' => 'Images',
			'article_gallery' => 'Article Gallery',
			'article_desc' => 'Article Desc',
			'article_content' => 'Article Content',
			'countview' => 'Countview',
			'focus' => 'Focus',
			'itemorder' => 'Itemorder',
			'creator' => 'Creator',
			'created' => 'Created',
			'editor' => 'Editor',
			'edited' => 'Edited',
			'active' => 'Active',
			'recycle' => 'Recycle',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('name',$this->name,true);
		$criteria->compare('keyword',$this->keyword,true);
		$criteria->compare('cat_id',$this->cat_id);
		$criteria->compare('effecttime',$this->effecttime);
		$criteria->compare('expiredtime',$this->expiredtime);
		$criteria->compare('images',$this->images,true);
		$criteria->compare('article_gallery',$this->article_gallery,true);
		$criteria->compare('article_desc',$this->article_desc,true);
		$criteria->compare('article_content',$this->article_content,true);
		$criteria->compare('countview',$this->countview);
		$criteria->compare('focus',$this->focus);
		$criteria->compare('itemorder',$this->itemorder);
		$criteria->compare('creator',$this->creator);
		$criteria->compare('created',$this->created);
		$criteria->compare('editor',$this->editor);
		$criteria->compare('edited',$this->edited);
		$criteria->compare('active',$this->active);
		$criteria->compare('recycle',$this->recycle);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}